package com.gz.logistics.library.pojo;

import org.json.JSONArray;
import org.json.JSONException;

import java.util.ArrayList;
import java.util.List;

/**
 * 杜志娟
 * 小区列表
 * Created by Administrator on 2016/3/11.
 */
public class ClothesGroup extends CustomerSpinnerObject{
    private int id;//小区id
    public String groupname;
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getGroupname() {
        return groupname;
    }

    public void setGroupname(String groupname) {
        this.groupname = groupname;
    }
    @Override
    public String toString() {
        return groupname;
    }

    public static List<ClothesGroup> parse(JSONArray jsonArray) throws JSONException {
        if (jsonArray == null || jsonArray.length() <= 0){
            return null;
        }
        List<ClothesGroup> groups = new ArrayList<ClothesGroup>();
        for (int i = 0 ; i < jsonArray.length() ; i ++ ){
            ClothesGroup group = new ClothesGroup();
            group.id = (jsonArray.getJSONObject(i)).getInt("id");
            group.groupname = (jsonArray.getJSONObject(i)).getString("name");
            groups.add(group);
        }
        return groups;
    }
}
